<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件的修饰符</title>

    <style>
        .rect{
            display: block;
            background-color: red;

        }
        .blue{
            display: block;
            background-color: blue;
        }
    </style>

</head>
<body>
    <script src='/js/vue.js'></script>
    <div id='app'>

        <!-- .stop修饰符 阻止单击事件的继续传播，阻止事件的冒泡行为 -->
        <div @click="divClick()">
            999
            <button @click="btnClick()">button</button>

        </div>
        <!-- .prevent修饰符，对某些DOM元素进行操作的时候，他会有一些默认行为 -->

        <form action="baidu">
            <input type="submit" value="提交" @click.prevent="inputClick()">
        </form>

        <!-- .self修饰符，只监听该DOM元素本身的事件 -->
        <div class="rect" @click.self="alertRed">
            <div class="blue" @click="alertBlue"></div>
        </div>
        <!-- .once修饰符，页面加载后只触发一次，可用于阻止多次触发的事件 -->
        <button @click.once="btnClick">button</button>

        <input type="text" @keyup="keyup">


    </div>
    
    <script>
        let app = new Vue({
            el:'#app',
            data:{
                msg:'hello word'
            },
            methods:{
                diviClick(){
                    console.log("divClick");
                },
                
                btnClick(){
                    console.log("btnClick");
                },
                alertRed(){
                    console.log("divClick");
                },
                alertBlue(){
                    console.log("divClick");
                }
            }

       })
    </script>
</body>
</html>